package com.csdj.rest.controller;

import com.csdj.beans.entity.Menu;
import com.csdj.common.WebResult;
import com.csdj.common.constant.CommonConstant;
import com.csdj.rest.service.MenuService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
public class MenuController {
    @Resource
    private MenuService menuService;

    @GetMapping("/menus")
    public WebResult getMenu(HttpServletRequest request){
        String uid = request.getHeader(CommonConstant.HEADER_USER_ID);
        final List<Menu> menus = menuService.getMenus();
        return WebResult.success(menus);
    }
}
